package leetcode.code0845;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int longestMountain(int[] arr) {
		int len = arr.length;
		int[] dp = new int[len];
		dp[0] = 1;
		for (int i = 1; i < len; i++) {
			dp[i] = arr[i] > arr[i - 1] ? dp[i - 1] + 1 : 1;
		}
		int h = 1;
		int ans = 0;
		for (int i = len - 2; i > 0; i--) {
			if (arr[i] > arr[i + 1]) {
				if (dp[i] > 1) {
					ans = Math.max(ans, h + dp[i]);
				}
				h += 1;
			} else {
				h = 1;
			}
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
